using System;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI;
using System.ComponentModel;

namespace GDC.Utility.Web
{
	/// <summary>
	/// Summary description for ImgRangeValidators.
	/// </summary>
	public class ImgCustomValidator :  CustomValidator
	{
		public ImgCustomValidator() : base()
		{
			img = new HtmlImage();
			img.Src = "~\\Images\\errorprovider.gif";
			img.Border = 0;
			img.Style.Add("cursor", "help");
			this.Controls.Add(this.img);
		}

		
		private HtmlImage img;
	
		protected override void Render(System.Web.UI.HtmlTextWriter writer)
		{
			if (this.is_anima)
			{
				img.Src = "~\\Images\\errorprovider_anim.gif";
			}
			base.Render (writer);			
		}
	
		[Bindable(true), 
		Category("Appearance"), 
		DefaultValue("Error")] 
		public override string ToolTip
		{
			get
			{
				return this.img.Alt;
			}
			set
			{
				this.img.Alt = value;
			}
		}

		private bool is_anima = false;
		[Bindable(true), 
		Category("Appearance"), 
		DefaultValue(false)] 
		public virtual bool IsAnimation
		{
			get
			{
				return is_anima;
			}
			set
			{
				this.is_anima = value;
			}
		}
	}
}
